﻿<head>

<style type="text/css">
.talkbox {
    width: 400px;
    min-height: 120px;
    max-height: 300px;
    _height: 120px;
    margin-left: auto;
    margin-right: auto;
    padding: 3px;
    outline: 0;
    border: 1px solid #a0b3d6;
    font-size: 12px;
    word-wrap: break-word;
    overflow-x: hidden;
    overflow-y: auto;
    _overflow-y: visible;
}
        </style>
	
	
	
	
	
	
	
	
	
        <script type="text/javascript">
function load()

{
          alert("ffff");
	  
	  document.getElementById("tt").value=document.getElementById("test_name").innerHTML;
          }
	
	


          function  buttonClick(){


          document.getElementById("test_name").value=document.getElementById("tt").innerHTML;

          }

          function getValue(){


          var val= prompt('请输入超链接:', 'http://');

          alert(val);



          var img;
          img = document.createElement("IMG");

          img.src = "http://img01.taobaocdn.com/imgextra/i1/202062870/T20HtkXdRbXXXXXXXX_!!202062870.jpg";
          document.getElementById("tt").appendChild(img);
          document.getElementById("test_name").value += ocument.getElementById("tt").innerText;




          deliver();
          }
        </script>
</head>
<body onload="load()">


<%= form_for(@test) do |f| %>
  <% if @test.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@test.errors.count, "error") %> prohibited this test from being saved:</h2>

      <ul>
      <% @test.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :name %><br />
      <%= f.text_area :name,"cols" => 40,"rows"=>4, %>


        <div id="editor">

            <span class="button" title="insertimage" id="image" unselectable="on"  onclick="getValue()">图像</span>
            
        </div>
    
        <div class="test_box" id="tt" contentEditable = "true" value ="dffdd">fffff打算</div> 
  
  </div>
  <div class="actions">
   <%= f.submit "提交", :onclick => "return buttonClick();" %>
  </div>
  

<% end %>
  </body>